#!/usr/bin/env bash

# download the rpm file && install the repo
# this is the file original url: https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
curl -o mysql80-community-release-el7-3.noarch.rpm https://gitee.com/wm418672696/mysql-install-test/raw/master/mysql80-community-release-el7-3.noarch.rpm && \
yum localinstall -y mysql80-community-release-el7-3.noarch.rpm

# install mysql
yum install -y mysql-community-server

# start mysql service
systemctl start mysqld

# enable mysql to start after system rebooting
systemctl enable mysqld

# stop the firewall
systemctl stop firewalld.service

# disable firewall to start after system rebooting
systemctl disable firewalld.service

# check the initiated password
grep 'temporary password' /var/log/mysqld.log
